import Vue from 'vue'
import Layout from './Layout'
import XHeader from './xheader'
import XBody from './XBody'
import XFooter from './XFooter'
import Wrapper from './Wrapper'
import Sidebar from './Sidebar'
import Heading from './Heading'
import XInput from './XInput'
import XInputMoney from './XInputMoney'
import XCarouselItem from './XCarouselItem'
import XImg from './XImg'
import Avatar from './Avatar'
import {Cellbox, CellItem} from './cellbox'
import Preview from './Preview'
import PreviewBox from './PreviewBox'
import Placeholder from './Placeholder'

const components = {
  Layout,
  XHeader,
  XBody,
  XFooter,
  Wrapper,
  Sidebar,
  Heading,
  XInput,
  XInputMoney,
  XCarouselItem,
  XImg,
  Avatar,
  Cellbox,
  CellItem,
  Preview,
  PreviewBox,
  Placeholder
}

/*
 const install = function(Vue, opts = {}) {
 if (window.installed) return;
 components.map(component => {
 Vue.component(component.name, component);
 });
 window.installed = true
 };
 install(Vue);
 */

const install = function (Vue, opts = {}) {
  if (window.installed) return
  for (let name in components) {
    Vue.component(name, components[name])
  }
  window.installed = true
}
install(Vue)

export default components
